<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>时间日期组件</title>
  <link rel="stylesheet" href="./datetime.css" />
  <script type="module" src="/src/components/component/componentRegister.js"></script>
  <script type="module" src="/src/components/component/componentManager.js"></script>
</head>

<body>
  <div id="datetime-container"></div>

  <!-- 改为 type="module" 并显式导入 -->
  <script type="module">
    import '/src/components/component/componentRegister.js';
    import { ComponentManager } from '/src/components/component/componentManager.js';

    $(function () {
      const datetime = ComponentManager.create('datetime', '#datetime-container', {
        format: 'YYYY:MM:DD HH:mm:ss',
        autoStart: true,
        editable: false,
        fieldName: 'current_time'
      });
      datetime.init(); // 注意：await
    });
  </script>
</body>

</html>